<h2>Editing <%=@project.name %></h2>

<div class="groupbox">
<div id="title">Project</div>
created <%= time_ago_in_words(@project.created_on) %> ago<br/>
updated <%= time_ago_in_words(@project.updated_on) %> ago<br/>
<% form_tag(:action=> :update, :id => @project) do %>
<%= text_field(:project, :name, :size => 20) %>
<input class="button" type="submit" value="Change name">
<% end %>
</div>

<div class="groupbox">
<div id="title">Users</div>
<ul class="mylist">
<% @project.users.each do |u| %>
   <li id="u<%=u.id%>">
   	<%= u.name %> (<%=Task.count(:all,:conditions=>["project_id= ? and user_id = ? ",@project.id,u.id])%> tasks)
		<%= link_to_remote (image_tag('delete.gif'), {:url=>{:action=>'del_user',:id=>u.id, :p_id=>@project.id}, :update => "u#{u.id}",:confirm=>'Remove this user from this project?'})%>
	</li>
<% end %>
</ul>
</div>

<div class="groupbox">
<div id="title">Add users</div>
<strong>If your email is empty the mail will come from PTM.<br/>
If your mail address is not correctly formed, mails could be refused by the receiver email program.</strong><br/>
<br/>
<% form_tag(:controller=>:invitation, :action=>:add_users, :id => @project) do %>
Enter your name, it will appear in the email PTM will send:<br/>
<%= text_field(:invite, :name, {:value=>session['user']['name']})%><br/>
Enter the personal message you want to attach to the invitation:<br/>
<textarea name="invite[msg]" rows="4"	cols="40">Come to join my project !</textarea><br/>
Enter one user email per line to invite them to join this project:<br/>
<textarea onfocus="if(this.value=='example@example.com')this.value=''" name="invite[emails]" rows="4"	cols="40">example@example.com</textarea><br/>
<%=submit_tag "Invite"%>
<% end %>
</div>
